package com.enki.cigarettes.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * @author WCS.Wang
 * @version V1.0
 * @Package com.enki.cigarettes.utils
 * @Name e-cigarettes-shop-api
 * @Description: TODO 时间工具类
 * @date 2019-07-19
 */
public class DateUtils {

    private static final String YMDHMS = "yyyy-MM-dd HH:mm:ss";

    private static final String YMD = "yyyy-MM-dd";

    /**
     * @param date
     * @return
     */
    public static String getDateYMDHMS(Date date) {
        SimpleDateFormat sdf = new SimpleDateFormat(YMDHMS);
        return sdf.format(date);
    }


    public static String getDateYMD(Date date) {
        SimpleDateFormat sdf = new SimpleDateFormat(YMD);
        return sdf.format(date);
    }

    /**
     * 获取下一年今天的时间
     * @return
     */
    public static Date getNextYearDay() {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.YEAR, 1);
        return calendar.getTime();
    }
}
